<?php

namespace App\Http\Requests\Admin;

use App\Http\Requests\ApiRequest;

/**
 * @property int article_type_id
 * @property string title
 * @property int per_page
 */
class ArticleIndexRequest extends ApiRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'article_type_id'     => 'sometimes|numeric',
            'title'               => 'sometimes|string',
        ];
    }

    /**
     * @return array
     */
    public function messages()
    {
        return [
            'article_type_id.*'     => ':attribute必须是数字',
            'title.*'               => ':attribute必须是字符串',
        ];
    }

    /**
     * @return array
     */
    public function attributes()
    {
        return [
            'article_type_id'     => '文章的类别',
            'title'               => '文章的标题',
        ];
    }
}
